﻿[assembly:
        System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.ValueHandlers.TextBoxValueHandler.js",
                "application/x-javascript")]
[assembly:
        System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.ValueHandlers.TextBoxValueHandler.debug.js",
                "application/x-javascript")]

namespace BM.Tools.WebControls.MForm.Controls.ValueHandlers
{
    using System.Web.UI;
    using System.Web.UI.WebControls;

    using AjaxControlToolkit;

    using BM.Tools.WebControls.MForm.Controls.Helper;
    using BM.Tools.WebControls.MForm.Controls.Items;

    /// <summary>
    /// A control that binds the <see cref="LeafItem" /> control with a <see cref="TextBox" /> control.
    /// </summary>    
    [ClientScriptResource("BM.Tools.WebControls.MForm",
            "BM.Tools.WebControls.MForm.Controls.ValueHandlers.TextBoxValueHandler.js")]
    public class TextBoxValueHandler : StandardWebControlValueHandler<TextBox>
    {
        /// <summary>
        /// Gets or sets TextBox.
        /// </summary>
        /// <value>
        /// The text box.
        /// </value>
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public TextBox TextBox
        {
            get
            {
                return Control;
            }

            set
            {
                Control = value;
            }
        }

        /// <summary>
        /// Prepares the css class of the web control
        /// </summary>
        /// <returns>
        /// the CssClasses collection
        /// </returns>
        protected override CssClasses PrepareCssClass()
        {
            CssClasses cssClasses = base.PrepareCssClass();
            cssClasses.Add("Text");
            return cssClasses;
        }        
    }
}